<template>
  <TableView
    ref="tableView"
    :table-attrs="{ api: getPage, descs: ['createTime'], payloadStyle: 'body', dicOptions: [] }"
    :form-path="formRoute"
    :search-model="searchForm"
    :delete-api="batchDelete"
    :toolbar-attrs="{ buttons: ['slot', 'del', 'create'] }">
    <template #columns>
      <TableColumn label="委托业务名称" clickable prop="entrustedBusiness" />
      <TableColumn label="所属部门名称" prop="departmentName" />
      <TableColumn label="所属专业" prop="major" />
      <TableColumn label="合同编号" prop="contractNumber" />
      <TableColumn label="经费来源" prop="foundSource" />
      <TableColumn label="预算金额" prop="budget" />
      <TableColumn label="审查时间" prop="auditTime" />
      <TableColumn label="所属项目名称" prop="projectName" />
      <TableColumn label="所属项目编号" prop="projectNo" />
      <TableColumn label="项目状态" prop="projectStatus" dict-type="project_status" />
    </template>
    <template #search-form>
      <FormInput v-model="searchForm.entrustedBusiness" label="委托业务名称" prop="entrustedBusiness" />
      <FormInput v-model="searchForm.departmentName" label="所属部门名称" prop="departmentName" />
      <FormInput v-model="searchForm.major" label="所属专业" prop="major" />
      <FormInput v-model="searchForm.foundSource" label="经费来源" prop="foundSource" />
      <FormInput v-model="searchForm.projectNo" label="所属项目编号" prop="projectNo" />
      <FormInput v-model="searchForm.projectName" label="所属项目名称" prop="projectName" />
      <FormInput v-model="searchForm.contractNumber" label="合同编号" prop="contractNumber" />
    </template>
  </TableView>
</template>

<script>
  import { getPage, batchDelete } from './api'

  export default {
    name: 'ProjectDelegateView',
    data() {
      return {
        searchForm: {
          entrustedBusiness: null,
          departmentName: null,
          major: null,
          foundSource: null,
          projectNo: null,
          projectName: null,
          contractNumber: null
        }
      }
    },
    methods: {
      getPage,
      batchDelete,
      formRoute(item) {
        return `/tech-project/project-manage/delegate/ProjectDelegateForm/{id:-1}?tabTitle=${item ? item.entrustedBusiness : '新建项目委托'}`
      }
    }
  }
</script>
